package com.em.utils.page;

import lombok.Data;

import java.io.Serializable;

/**
 * 统一返回结果
 *
 * @author exclusive
 * @version 1.0
 */
@Data
public class Result<T> implements Serializable {

    /**
     * 200成功，其它数字为失败
     */
    private String code;
    /**
     * 消息
     */
    private String msg;
    /**
     * 数据
     */
    private T data;

    /**
     * 返回结果
     */
    public static <T> Result<T> result(Result<T> otherResult) {
        Result<T> result = new Result<>();
        result.code = otherResult.getCode();
        result.msg = otherResult.getMsg();
        result.data = otherResult.getData();
        return result;
    }

}
